﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="UpperLimitPanel.aspx.cs" Inherits="LotteryVote.UpperLimitPanel" %>

<%@ Register Src="~/Controls/GamePlayWayList.ascx" TagPrefix="LV" TagName="GamePlayWay" %>
<%@ Register Src="~/Controls/TodayCompanyList.ascx" TagPrefix="LV" TagName="CompanyList" %>
<asp:Content ID="Header" ContentPlaceHolderID="head" runat="server">
    <link href="Style/TableBaseStyle.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        tr.willFull td
        {
            color: Blue;
        }
    </style>
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="main" runat="server">
    <div id="searchBar">
        <span>
            <%=GetGlobalResourceObject("Resource","Num") %></span>
        <asp:TextBox ID="txt_num" runat="server"></asp:TextBox>
        <span>
            <%=GetGlobalResourceObject("Resource","GameType") %></span>
        <LV:GamePlayWay ID="lv_gameplayway" runat="server" />
        <span>
            <%=GetGlobalResourceObject("Resource","Company") %></span>
        <LV:CompanyList ID="lv_company" runat="server" />
        <asp:Button ID="btn_Search" runat="server" Text="<%$Resources:Resource,Search %>"
            OnClick="btn_Search_Click" />
        <input type="checkbox" id="autoRefresh" name="autoRefresh"  '<%=IsAutoRefresh?" checked='checked'":"" %>' />
        <label for="autoRefresh">
            <%=GetGlobalResourceObject("Resource","AutoRefresh") %></label>
        <span>
            <%=GetGlobalResourceObject("Resource","Game")%></span>
        <asp:DropDownList ID="ddl_game" runat="server">
        </asp:DropDownList>
        <input id="refresh" type="button" value="<%=GetGlobalResourceObject("Resource","Refresh") %>" />
    </div>
    <asp:Repeater ID="rpt_2D" runat="server" OnItemCommand="rpt_2D_ItemCommand">
        <HeaderTemplate>
            <table cellpadding="0" cellspacing="0" style="width: 100%">
                <thead>
                    <tr>
                        <td colspan="9">
                            <%=GetGlobalResourceObject("Resource","BetLimit") %>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <%=GetGlobalResourceObject("Resource","No") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","Num") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","GameType") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","Company") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","TotalBetAmount") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","DropWater") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","NextLimit") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","UpperLimit") %>
                        </td>
                        <td>
                            <%=GetGlobalResourceObject("Resource","Function") %>
                        </td>
                    </tr>
                </thead>
                <tbody>
        </HeaderTemplate>
        <ItemTemplate>
            <tr class='<%#GetColClass(Eval("TotalBetAmount"),Eval("UpperLlimit"),Eval("StopBet")) %>'>
                <td>
                    <%# Container.ItemIndex+1 %>
                </td>
                <td>
                    <%#Eval("Num")%>
                </td>
                <td>
                    <%# ParseGamePlayWay(Eval("GamePlayWayId"))%>
                </td>
                <td>
                    <%#ParseCompany(Eval("CompanyId")).Name%>
                </td>
                <td>
                    <%#Eval("TotalBetAmount")%>
                </td>
                <td>
                    <%#Eval("DropValue")%>
                </td>
                <td>
                    <%#Eval("NextLimit")%>
                </td>
                <td>
                    <%#Eval("UpperLlimit")%>
                </td>
                <td>
                    <asp:LinkButton ID="lbtn_startBet" runat="server" Text="<%$Resources:Resource,Start %>"
                        CommandName="Start" CommandArgument='<%#Eval("LimitId") %>' Visible='<%#Eval("StopBet") %>'></asp:LinkButton>
                    <asp:LinkButton ID="lbtn_StopBet" runat="server" Text="<%$Resources:Resource,Stop %>"
                        CommandName="Stop" CommandArgument='<%#Eval("LimitId") %>' Visible='<%# !Convert.ToBoolean(Eval("StopBet")) %>'></asp:LinkButton>
                    <a href="javascript:void()" class="addLimit" limit='<%#Eval("LimitId") %>'>
                        <%=GetGlobalResourceObject("Resource","AddLimit") %></a>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </tbody></table></FooterTemplate>
    </asp:Repeater>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#autoRefresh").bind("change", function () {
                if (isCheck($(this)))
                    postBack("AutoRefresh", "true", true);
                else
                    postBack("AutoRefresh", "false", true);
            });
            $("#refresh").bind("click", function () {
                var gameType = $("#<%=ddl_game.ClientID %>").val();
                postBack("game", gameType);
            });
            $(".addLimit").bind("click", function () {
                buildFrame("addLimit", 250, 400, "UpdateUpperLimit.aspx?LimitId=" + $(this).attr("limit"));
            });
        });
    </script>
</asp:Content>
